<?php


namespace livez;
use think\Db;
use livez\src\Rtctokenbuilder as  RtcToken;
use livez\src\Rtmtokenbuilder;
use livez\test\TestTool;
use DateTimeZone;
use DateTime;
//配置文件
/**
 * 根据单据ID获取流程信息
 */
class Livez{

    public $appID = "1492fdfc03da4497b0d693a5df9205db";
    public $appCertificate =  "d72d51638cfc4f218a558b73b75700f3";
    public $uid =  "";
    public $channelname =  "";
    public $role =  "";

	public function RtcTokenBuilder(){
		$expireTimeInSeconds = 3600;
		$currentTimestamp = (new DateTime("now", new DateTimeZone('UTC')))->getTimestamp();
		$privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds;
		$token = RtcToken::buildTokenWithUid($this->appID, $this->appCertificate, $this->channelname, $this->uid, $this->role, $privilegeExpiredTs);
		//$token = RtcTokenBuilder::buildTokenWithUserAccount($appID, $appCertificate, $channelName, $uidStr, $role, $privilegeExpiredTs);
		return $token;
	}	
	public function RtmTokenBuilder(){
		$expireTimeInSeconds = 3600;
		$currentTimestamp = (new DateTime("now", new DateTimeZone('UTC')))->getTimestamp();
		$privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds;
		$token = Rtmtokenbuilder::buildToken($this->appID, $this->appCertificate, $this->uid, $this->role, $privilegeExpiredTs);
		return $token;
		
	}

}